package 竞赛.NO_401;

import java.util.Arrays;

/**
 * 3179. K 秒后第 N 个元素的值
 * 创建时间：2024-06-09 10:12
 */
public class K秒后第N个元素的值_3179 {
    public int valueAfterKSeconds(int n, int k) {
        int[] arr = new int[n];
        Arrays.fill(arr, 1);
        for (int sec = 0; sec < k; sec++) {
            int[] newArr = new int[n];
            newArr[0] = arr[0];
            for (int i = 1; i < n; i++) {
                newArr[i] = (newArr[i - 1] + arr[i]) % 1000000007;
            }
            arr = newArr;
        }
        return arr[n-1];
    }
}
